home *** CD-ROM | disk | FTP | other *** search
- /* viewget.c - get_cmd functions - get an input command */
- #include "stdio.h"
- #include "cminor.h"
- #include "viewcmds.h"
- #include "viewparm.h"
-
- /* definition of key values returned by getkey */
- #include "keyio.h"
-
- int get_cmd() /* get next input command from keyboard */
- { /* returns the command type entered */
- int key ; /* holds the keyboard input value */
- /* ( see keyio.h ) for values */
- int cmd ; /* holds the command type value */
-
- prompt() ; /* display prompts */
- cmd = INVALIDCMD ; /* setup for key entry test */
- while( cmd == INVALIDCMD )
- { key = getkey() ; /* get next keyboard input */
- switch( key ) /* clasify the key pressed */
- {
- case PGDNKEY : cmd = NEXTPAGE ;break ;
- case PGUPKEY : cmd = PREVPAGE ;break ;
- case ASCESC : cmd = EXITPGM ;break ;
- case ' ' : cmd = MOVETOPOS ;break ;
- case HOMEKEY : cmd = FIRSTPAGE ;break ;
- case ENDKEY : cmd = LASTPAGE ;break ;
- case UPARROW : cmd = PREVLINE ;break ;
- case DOWNARROW : cmd = NEXTLINE ;break ;
- default : cmd = INVALIDCMD ;
- } /* end of switch statement */
- }
- return(cmd) ;
- }
-
- int prompt() /* display prompts */
- {
- #define UP_A 24 /* displays up arrow */
- #define DN_A 25 /* displays down arrow */
-
- printf( "\n Type one of these Input Commands") ;
- printf( "\n HOME = First Page ") ;
- printf( " %c = Previous Line ",UP_A) ;
- printf( "PG UP = Previous Page ") ;
- printf( "\n END = Last Page ") ;
- printf( " %c = Next Line ",DN_A) ;
- printf( "PG DN = Next Page ") ;
- printf( "\n ESC = Exit Program ") ;
- printf( "SPACE = Move to position ");
- }
-
-
-